#Makefile: Makefile to compile source code for lab3
#Author: Andy Wu

OPT = -Wall -g -pedantic

d: dsegment
all: dsegment encoder classes
c: classes
#d: dsegment
e: encoder

dsegment: dsegment.cc dsegment.h
	g++ $(OPT) dsegment.cc dsegment.h -o dsegment

dsegment.o: dsegment.cc dsegment.h
	g++ $(OPT) dsegment.cc -c dsegment.o

encoder: hasher.o hashtbl.o classes.o encoder.o
	g++ -o encoder $(OPT) hasher.o hashtbl.o classes.o encoder.o

hasher.o: hasher.cc EncodedStructs.h hashtbl.h
	g++ -o hasher.o $(OPT) -c hasher.cc

hashtbl.o: hashtbl.cc hashtbl.h
	g++ -o hashtbl.o $(OPT) -c hashtbl.cc

classes.o: AssemblerClasses.cc AssemblerClasses.h
	g++ -o classes.o $(OPT) -c AssemblerClasses.cc

encoder.o: encoder.cc EncodedStructs.h hashtbl.h
	g++ -o encoder.o $(OPT) -c encoder.cc

tokenizer.o: tokenizer.cpp tokenizer.h
	g++ $(OPT) tokenizer.cpp -o tokenizer.o

clean:
	rm -f *.o dsegment encoder assembler